<?php
namespace App\Http\Controllers\Admin;

/**
 * 后台的控制器
 * Class Controller
 * @package App\Http\Controllers\Admin
 */
class Controller extends \App\Http\Controllers\Controller
{
    /**
     * 成功返回的JSON
     * @param array $data
     * @param string $message
     * @param int $code
     * @return \Illuminate\Http\JsonResponse
     */
    public function responseSuccess($data=[], $message='', $code=20000){
        return response()->json([
            'data' => $data,
            'msg' => $message,
            'code' => $code,
        ]);
    }

    /**
     * 失败返回的JSON
     * @param string $message
     * @param array $data
     * @param int $code
     * @return \Illuminate\Http\JsonResponse
     */
    public function responseError($message='', $data=[], $code=40000){
        return response()->json([
            'msg' => $message,
            'data' => $data,
            'code' => $code
        ]);
    }
}
